package com.kwok.rbac.application.mapper;

import com.kwok.rbac.application.entity.Privilege;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 权限表 Mapper 接口
 * </p>
 *
 * @author baomidou
 * @since 2024-05-25
 */
public interface PrivilegeMapper extends BaseMapper<Privilege> {

    //根据角色ID给角色赋予权限(权限的批量添加)
    Integer privilegeToRole(@Param("roleId") Integer roleId, @Param("privilegeIdList") List<Integer> privilegeIdList);

    //根据角色ID获取角色所拥有的权限(权限的查询)
    List<Privilege> getPrivilegeByRoleId(Integer roleId);

    //根据用户ID获取用户所拥有的权限
    List<Privilege> getPrivilegeByUserId(Integer userId);

}
